package sqlanalysisgui;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

import sqlanalysisgui.menuaction.ProjectInfoDialogAction;

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
	private IWorkbenchAction exitAction;
	private IWorkbenchAction aboutAction;
	private IWorkbenchAction projectStartAction;

	public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
		super(configurer);
	}

	@Override
	protected void makeActions(IWorkbenchWindow window) {
		exitAction = ActionFactory.QUIT.create(window);
		register(exitAction);

		aboutAction = ActionFactory.ABOUT.create(window);
		register(aboutAction);

		// projectStartAction = ActionFactory.ABOUT.create(window);
		projectStartAction = new ProjectInfoDialogAction();
//		projectStartAction.setText("소스분석하기@Ctrl+A");
		projectStartAction.setText("소스분석");
//		projectStartAction.setAccelerator(SWT.CTRL + 'A');
		register(projectStartAction);

	/*	Action actionExit = new Action("&소스분석하기@Ctrl+A") {
			public void run() {
				((ProjectInfoDialogAction)projectStartAction).openDialog();
			}
		};*/
	}

	@Override
	protected void fillMenuBar(IMenuManager menuBar) {
		MenuManager hyManager = new MenuManager("&프로젝트", "project");
		hyManager.add(projectStartAction);
		hyManager.add(aboutAction);
		hyManager.add(exitAction);

		menuBar.add(hyManager);
		// hyManager.add(new GroupMarker("other-actions"));
		// hyManager.add(new Separator());
		// hyManager.appendToGroup("other-actions", aboutAction);

		// MenuManager helpMenu = new MenuManager("&Help", "help");
		// helpMenu.add(aboutAction);

		// hyManager.add(helpMenu);
	}

}
